<!DOCTYPE HTML>
<html>
<head>
    <include file="Public/head"/>
</head>
<body>
<!-- 头部 -->
<include file="Public/header1"/>
<!-- /头部 -->
<block name="style">
    <link href="__CSS__/usercenter.css" rel="stylesheet" type="text/css"/>
</block>

<block name="body">
    <div id="main-container" class="container">
        <div class="row bgwhite" style="margin-top: 0;min-height: 580px;padding-top: 200px;">
            <div class="col-xs-12">
                <div class="btn-group" style="display: none">
                    <a href="{:addons_url('SyncLogin://Base/bind',array('tip'=>'new'))}"
                       class="btn btn-default <if condition="$tip eq 'new'">active</if>">新帐号</a>
                    <a href="{:addons_url('SyncLogin://Base/bind',array('tip'=>'exist'))}"
                       class="btn btn-default <if condition="$tip eq 'exist'">active</if>">绑定已有帐号</a>

                </div>
            </div>

            <div class="col-xs-12 col-md-8 col-md-offset-2" style="margin-top: 30px;">
                <php> if($tip =='new'){</php>
                <form action="{:addons_url('SyncLogin://Base/newAccount')}" method="post">
                    <div class="form-group" style="display: none">
                        <label for="username" class=".sr-only col-xs-12" style="display: none"></label>
                        <input type="text" id="username" onblur="setNickname(this);" class="form-control"
                               placeholder="请输入用户名"
                               ajaxurl="/member/checkUserNameUnique.html" errormsg="请填写1-16位用户名"
                               nullmsg="请填写用户名"
                               datatype="*1-16" value="" name="username">

                        <div class="clearfix"></div>
                    </div>
                    <div class="form-group" style="display: none">
                        <label for="nickname" class=".sr-only col-xs-12" style="display: none"></label>
                        <input type="text" id="nickname" class="form-control" placeholder="请输入昵称"
                               ajaxurl="/member/checkNickNameUnique.html" errormsg="请填写1-16位昵称"
                               nullmsg="请填写昵称"
                               datatype="*1-16" value="" name="nickname">
                        <div class="clearfix"></div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail" class="col-md-2 col-xs-3" style="font-size: 18px;font-weight: 400;line-height: 35px;margin-bottom: 0;">常用邮箱</label>
                        <input  class="col-md-6 col-xs-9" style="height: 35px;" type="text" id="inputEmail" class="form-control" placeholder="请输入电子邮件"
                               ajaxurl="/member/checkUserEmailUnique.html" errormsg="请填写正确格式的邮箱" nullmsg="请填写邮箱"
                               datatype="e" value="" name="email">
                        <div class="col-md-4 col-xs-12" style="color: #f36119;line-height: 35px;">只能使用QQ邮箱</div>
                        <div class="col-md-6 col-md-offset-2 col-xs-12" style="color: #959595;">邮箱只用于找回密码和获得通知使用，我们绝不会发送任何广告！真的！</div>
                        <div class="clearfix"></div>
                    </div>
                    <div class="form-group" style="display: none">
                        <div id="password_block" class="input-group">
                            <input type="password" id="inputPassword" class="form-control" placeholder="请输入密码"
                                   errormsg="密码为6-20位" nullmsg="请填写密码" datatype="*6-20" name="password">

                            <div class="input-group-addon"><a style="width: 100%;height: 100%"
                                                              href="javascript:void(0);"
                                                              onclick="change_show(this)">show</a></div>
                        </div>
                        <div class="clearfix"></div>
                    </div>


                    <div class="col-md-offset-2"><button type="submit" class="btn btn-primary button_change">完 成</button></div>
                    <a href="{:addons_url('SyncLogin://Base/unbind')}" class="btn btn-success" style="display: none">我不想绑定，直接跳过</a>
                </form>
                <php>}</php>
                <php>if($tip == 'exist'){</php>
                <form action="{:addons_url('SyncLogin://Base/existLogin')}" method="post">
                    <div class="form-group">
                        <label for="inputEmail" class=".sr-only col-xs-12"></label>

                        <div class=" ">
                            <input type="text" id="inputEmail" class="form-control" placeholder="请输入用户名"
                                   ajaxurl="/member/checkUserNameUnique.html" errormsg="请填写1-16位用户名"
                                   nullmsg="请填写用户名"
                                   datatype="*1-16" value="" name="username">
                        </div>
                        <div class="clearfix"></div>
                    </div>
                    <div class="form-group">
                        <label for="inputPassword" class=".sr-only col-xs-12"></label>

                        <div class="">
                            <div id="password_block" class="input-group">
                                <input type="password" id="inputPassword" class="form-control" placeholder="请输入密码"
                                       errormsg="密码为6-20位" nullmsg="请填写密码" datatype="*6-20" name="password">

                                <div class="input-group-addon"><a style="width: 100%;height: 100%"
                                                                  href="javascript:void(0);"
                                                                  onclick="change_show(this)">show</a></div>
                            </div>
                        </div>

                        <div class="clearfix"></div>
                    </div>

                    <div class="checkbox lg_lf_fm_checkbox">
                        <label>
                            <input type="checkbox" name="remember" style="cursor:pointer;"> 记住登录
                        </label>
                    </div>
                    <button type="submit" class="btn btn-primary">登 录</button>
                    <div class="clearfix"></div>
                </form>
                <php>}</php>
            </div>
        </div>


</div>

</block>

<block name="script">
    <script>
        if (MID == 0) {
            $(document)
                    .ajaxStart(function () {
                        $("button:submit").addClass("log-in").attr("disabled", true);
                    })
                    .ajaxStop(function () {
                        $("button:submit").removeClass("log-in").attr("disabled", false);
                    });
            $("form").submit(function () {
                var self = $(this);
                $.post(self.attr("action"), self.serialize(), success, "json");
                return false;

                function success(data) {
                    if (data.status) {
                        toast.success(data.info, '温馨提示');
                        setTimeout(function () {
                            window.location.href = data.url
                        }, 1000);
                    } else {
                        toast.error(data.info, '温馨提示');
                        //self.find(".Validform_checktip").text(data.info);
                        //刷新验证码
                        $(".reloadverify").click();
                    }
                }
            });

            function change_show(obj) {
                if ($(obj).text().trim() == 'show') {
                    $('#inputPassword').attr('type', 'text');
                    $(obj).text('hide');
                } else {
                    $('#inputPassword').attr('type', 'password');
                    $(obj).text('show');
                }
            }

            function setNickname(obj) {
                var text = $(obj).val().trim();
                if (text != null && text != '') {
                    $('#nickname').val(text);
                }
            }

        }
    </script>
</block>

<!-- 底部 -->
<include file="Public/footer1"/>
<!-- /底部 -->

<script>
    $(function () {
        var $sidebar = $('#usercenter-sidebar-td');
        var $sidebar_xs = $('#usercenter-sidebar-xs');
        var $sidebar_sm = $('#usercenter-sidebar-sm');
        var $content = $('#usercenter-content-td');

        function trigger_resp() {
            var width = $(window).width();
            if (width < 768) {
                on_xs();
            } else {
                on_sm();
            }
        }

        function on_xs() {
            $sidebar_xs.append($sidebar);
            $content.css({'padding-left': 0, 'padding-right': 0});
        }

        function on_sm() {
            $sidebar_sm.prepend($sidebar);
            $content.css({'padding-left': '50px', 'padding-right': '50px'});
        }

        trigger_resp();

        $(window).resize(function () {
            trigger_resp();
        })
    })
</script>

</body>
</html>








